#include <CL/cl.h>
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
int pocl_cache_init_topdir ();
int
unsigned device_i, cl_kernel kernel,
_cl_command_node *command, int specialize);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#ifdef __cplusplus
}
extern "C" {
#endif
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
/* Remove a directory, recursively */
int pocl_rm_rf(const char* path);
int pocl_mk_tempname (char *output, const char *prefix, const char *suffix,
int *ret_fd);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#ifdef __cplusplus
}
#endif
}
unsigned cl_context_count = 0;
-pocl_lock_t pocl_context_handling_lock = POCL_LOCK_INITIALIZER;
+pocl_lock_t pocl_context_handling_lock __attribute__((visibility("hidden"))) = POCL_LOCK_INITIALIZER;
CL_API_ENTRY cl_context CL_API_CALL
POname(clCreateContext)(const cl_context_properties * properties,
#include "pocl_cl.h"
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
typedef pocl_lock_t ba_lock_t;
#define BA_LOCK(LOCK) POCL_LOCK(LOCK)
void
print_chunks (chunk_info_t *first);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#ifdef __cplusplus
}
#endif
extern "C" {
#endif
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
int llvm_codegen (char *output, unsigned device_i, cl_kernel kernel,
cl_device_id device, _cl_command_node *command,
int specialize);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
void fill_dev_image_t (dev_image_t *di, struct pocl_argument *parg,
cl_device_id device);
void fill_dev_sampler_t (dev_sampler_t *ds, struct pocl_argument *parg);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
void pocl_copy_mem_object (cl_device_id dest_dev, cl_mem dest,
size_t dest_offset,
cl_device_id source_dev, cl_mem source,
void pocl_scheduler (_cl_command_node * volatile * ready_list,
pthread_mutex_t *lock_ptr);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
void pocl_exec_command (_cl_command_node * volatile node);
void pocl_ndrange_node_cleanup(_cl_command_node *node);
+
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
void pocl_mem_objs_cleanup (cl_event event);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
void pocl_broadcast (cl_event event);
void pocl_init_dlhandle_cache ();
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
char *pocl_check_kernel_disk_cache (_cl_command_node *cmd, int specialized);
size_t pocl_cmd_max_grid_dim_width (_cl_command_run *cmd);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
void pocl_check_kernel_dlhandle_cache (_cl_command_node *command,
unsigned initial_refcount,
int specialize);
void pocl_release_dlhandle_cache (_cl_command_node *cmd);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
void pocl_setup_device_for_system_memory(cl_device_id device);
void pocl_reinit_system_memory();
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
void pocl_set_buffer_image_limits(cl_device_id device);
void* pocl_aligned_malloc_global_mem(cl_device_id device, size_t align, size_t size);
void pocl_free_global_mem(cl_device_id device, void *ptr, size_t size);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
void pocl_print_system_memory_stats();
void pocl_calculate_kernel_hash (cl_program program, unsigned kernel_i,
unsigned device_i);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
void pocl_init_default_device_infos (cl_device_id dev);
#ifdef __cplusplus
/* the enabled devices */
static struct _cl_device_id* pocl_devices = NULL;
unsigned int pocl_num_devices = 0;
+#if 0
unsigned int pocl_num_device_types = 0;
+#endif
/* Init function prototype */
typedef void (*init_device_ops)(struct pocl_device_ops*);
#include "../pocl_cl.h"
#include "config.h"
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
*/
unsigned int pocl_get_devices(cl_device_type device_type, struct _cl_device_id **devices, unsigned int num_devices);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
/**
* \brief Return the count of a specific device in the env var POCL_DEVICES
* \param dev_type a string describing the device ("basic" for instance)
int pocl_device_get_env_count(const char *dev_type);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
/**
* \brief Unique global memory id for devices with distinct memory from the system memory
* \return Unique global mem id, id > 0. Zero is reserved for shared system memory
*/
int pocl_get_unique_global_mem_id();
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
/* the environment variable that lists the enabled devices */
#define POCL_DEVICES_ENV "POCL_DEVICES"
#define POCL_LOCAL_SIZE_H
#include "pocl_cl.h"
+
/* The generic local size optimizer used by default, in case there's no target
* specific one defined in the device driver. */
void pocl_default_local_size_optimizer (cl_device_id dev, size_t global_x,
size_t *local_x, size_t *local_y,
size_t *local_z);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
/* Can be used for devices which support only small work-groups and prefer
* them to be maximally utilized to use as many of the SIMD lanes as possible.
* High compute unit utilization is only a secondary goal which typicaly
size_t global_y, size_t global_z,
size_t *local_x, size_t *local_y,
size_t *local_z);
+
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#endif
THE SOFTWARE.
*/
+#ifdef _MSC_VER
+# define PUSH_VISIBILITY_HIDDEN
+# define POP_VISIBILITY_HIDDEN
+#else
+# define PUSH_VISIBILITY_HIDDEN _Pragma ("GCC visibility push(hidden)")
+# define POP_VISIBILITY_HIDDEN _Pragma ("GCC visibility pop")
+#endif
+
#define GEN_PROTOTYPES(__DRV__) \
+ PUSH_VISIBILITY_HIDDEN \
void pocl_##__DRV__##_submit (_cl_command_node *node, cl_command_queue cq); \
void pocl_##__DRV__##_join (cl_device_id device, cl_command_queue cq); \
void pocl_##__DRV__##_flush (cl_device_id device, cl_command_queue cq); \
void pocl_##__DRV__##_wait_event (cl_device_id device, cl_event event); \
void pocl_##__DRV__##_update_event (cl_device_id device, cl_event event); \
void pocl_##__DRV__##_free_event_data (cl_event event); \
+ POP_VISIBILITY_HIDDEN \
void pocl_##__DRV__##_init_device_ops (struct pocl_device_ops *ops); \
+ PUSH_VISIBILITY_HIDDEN \
cl_int pocl_##__DRV__##_uninit (unsigned j, cl_device_id device); \
cl_int pocl_##__DRV__##_reinit (unsigned j, cl_device_id device); \
cl_int pocl_##__DRV__##_init (unsigned j, cl_device_id device, \
const char *kernel_name); \
cl_int pocl_##__DRV__##_get_builtin_kernel_metadata (void *data, \
const char *kernel_name, pocl_kernel_metadata_t *target); \
-
+ POP_VISIBILITY_HIDDEN
#define FALLBACK_MAX_THREAD_COUNT 8
+static
char scheduler_initialized = 0;
cl_int
/* Symbol aliases are supported */
# define POname(name) PO##name
-
-#define POdeclsym(name) __typeof__ (name) PO##name;
+# define POdeclsym(name) \
+ __typeof__(name) PO##name __attribute__((visibility("hidden")));
# define POCL_ALIAS_OPENCL_SYMBOL(name) \
__typeof__(name) name __attribute__((alias ("PO" #name), visibility("default")));
# define POsymAlways(name) POCL_ALIAS_OPENCL_SYMBOL(name)
#include "CL/cl.h"
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
/* This is set to 1 in case the cq profiling was enabled via POCL_TRACING=cq. */
extern int pocl_cq_profiling_enabled;
void pocl_cq_profiling_init ();
void pocl_cq_profiling_register_event (cl_event event);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#endif
#define POCL_FILTER_TYPE_WARN 2
#define POCL_FILTER_TYPE_ERR 3
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
/* Debugging macros. Also macros for marking unimplemented parts of specs or
untested parts of the implementation. */
#ifdef POCL_DEBUG_MESSAGES
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
extern uint64_t pocl_debug_messages_filter;
extern int stderr_is_a_tty;
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
#define POCL_DEBUGGING_ON (pocl_debug_messages_filter)
#if __GNUC__ >= 2
#define POCL_DEBUG_HEADER(FILTER, FILTER_TYPE) \
pocl_debug_print_header (__func__, __LINE__, #FILTER, FILTER_TYPE);
+
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
extern void pocl_debug_output_lock ();
extern void pocl_debug_output_unlock ();
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
extern void pocl_debug_messages_setup (const char *debug);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
extern void pocl_debug_print_header (const char * func, unsigned line,
const char* filter, int filter_type);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
extern void pocl_debug_measure_start (uint64_t* start);
extern void pocl_debug_measure_finish (uint64_t* start, uint64_t* finish,
const char* msg,
} \
while (0)
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#ifdef __cplusplus
}
#endif
#include <stdint.h>
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
typedef struct {
uint32_t state[5];
uint32_t count[2];
void pocl_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len);
void pocl_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#ifdef __cplusplus
}
#endif
/* Returns the cpu name as reported by LLVM. */
char *get_llvm_cpu_name ();
+
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
/* Returns if the cpu supports FMA instruction (uses LLVM). */
int cpu_has_fma();
int pocl_invoke_clang(cl_device_id Device, const char** Args);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#ifdef __cplusplus
}
extern "C" {
#endif
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
int pocl_is_option_set(const char *key);
+
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
int pocl_get_int_option(const char *key, int default_value);
int pocl_get_bool_option(const char *key, int default_value);
+
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
const char* pocl_get_string_option(const char *key, const char *default_value);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#ifdef __cplusplus
}
#endif
extern "C" {
#endif
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
extern const unsigned pocl_timer_resolution;
uint64_t pocl_gettimemono_ns();
int pocl_gettimereal(int *year, int *mon, int *day, int *hour, int *min, int *sec, int* nanosec);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
#ifdef __cplusplus
}
#endif
#error aligned malloc unavailable
#endif
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
uint32_t byteswap_uint32_t (uint32_t word, char should_swap);
float byteswap_float (float word, char should_swap);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
/* set rounding mode */
void pocl_restore_rm (unsigned rm);
/* get current rounding mode */
unsigned pocl_save_ftz ();
void pocl_restore_ftz (unsigned ftz);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
/* Finds the next highest power of two of the given value. */
size_t pocl_size_ceil2 (size_t x);
uint64_t pocl_size_ceil2_64 (uint64_t x);
* must be a non-zero power of 2.
*/
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
void *pocl_aligned_malloc(size_t alignment, size_t size);
+
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
#define pocl_aligned_free(x) POCL_MEM_FREE(x)
/* locks / unlocks two events in order of their event-id.
const size_t region[3],
const size_t row_pitch, const size_t slice_pitch);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
/**
* Push a command into ready list if all previous events are completed or
* in pending_list if the command still has pending dependencies
_cl_command_node * volatile * ready_list,
_cl_command_node * volatile * pending_list);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
/**
* Return true if a command is ready to execute (no more event in wait list
* or false if not
void pocl_update_event_queued (cl_event event);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
void pocl_update_event_submitted (cl_event event);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
void pocl_update_event_running_unlocked (cl_event event);
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
void pocl_update_event_running (cl_event event);
void pocl_update_event_complete_msg (const char *func, unsigned line,
void pocl_update_event_failed (cl_event event);
+#ifdef __GNUC__
+#pragma GCC visibility push(hidden)
+#endif
+
const char*
pocl_status_to_str (int status);
}
#endif
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
/* Common macro for cleaning up "*GetInfo" API call implementations.
* All the *GetInfo functions have been specified to look alike,
* and have been implemented to use the same variable names, so this